int
gbfputs(const QString& s, gbfile* file)
{
- // Why is this Latin1() and not toUtf8()? Becuase our string data is
- // already utf8 in most of the "C" places and calling toUtf8() here would
- // double encode them.
- const char* qs = xstrdup(s.toLatin1().data());
- unsigned int l = strlen(qs);
- int rv = gbfwrite(qs, 1, l, file);
- xfree(qs);
+ QByteArray qs = s.toUtf8();
+ int rv = gbfwrite(qs.constData(), 1, qs.size(), file);
return rv;
}
--- /dev/null
+No,Latitude,Longitude,Name,Description,Notes\r
+1,40.000000,-105.000000,"α","β","ξ"\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<gpx version="1.0" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/0">
+ <time>2014-09-15T13:42:34.269Z</time>
+ <bounds minlat="40.000000000" minlon="-105.000000000" maxlat="40.000000000" maxlon="-105.000000000"/>
+ <wpt lat="40.000000000" lon="-105.000000000">
+ <name>α</name>
+ <cmt>β</cmt>
+ <desc>ξ</desc>
+ </wpt>
+</gpx>
# check header detection features
gpsbabel -i unicsv,utc=0 -f ${REFERENCE}/headerdetection.unicsv -x transform,trk=wpt -o gpx,garminextensions -F ${TMPDIR}/headerdetection~unicsv.gpx
compare ${TMPDIR}/headerdetection~unicsv.gpx ${REFERENCE}/extensiondata~unicsv.gpx
+
+# check default encoding, i.e. utf-8 in and out.
+gpsbabel -i gpx -f ${REFERENCE}/unicsv_encoding.gpx -o unicsv -F ${TMPDIR}/unicsv_encoding.csv
+compare ${TMPDIR}/unicsv_encoding.csv ${REFERENCE}/unicsv_encoding.csv